package utils;
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;

public class MongoUtils {

	
	private static MongoClient client = null;
	
	private MongoUtils() {
		
	}
	
	public static MongoClient getClient() {
		if(client == null) {
			client =   MongoClients.create(PropertyUtils.get("mongo.uri"));
		}
		return client;
	}
	public static MongoDatabase getDatabase(String database) {
		return getClient().getDatabase(database);
	}
	
	public static void close() {
		if(client != null) {
			client.close();
		}
	}
	
}
